package com.daohang.dh.service.impl;

import com.daohang.dh.entity.MidpDirFilesEntity;
import com.daohang.dh.manager.MidpDirFilesManager;
import com.daohang.dh.service.MidpDirFilesService;
import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 未打标签文件表
 *
 * @author xiaomei
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018/05/23
 */
@Service("midpDirFilesService")
public class MidpDirFilesServiceImpl implements MidpDirFilesService {

	@Autowired
	private MidpDirFilesManager midpDirFilesManager;

	@Override
	public Page<MidpDirFilesEntity> listMidpDirFiles(Map<String, Object> params) {
		Query query = new Query(params);
		Page<MidpDirFilesEntity> page = new Page<>(query);
		midpDirFilesManager.listMidpDirFiles(page, query);
		return page;
	}

	@Override
	public R saveMidpDirFiles(MidpDirFilesEntity role) {
		int count = midpDirFilesManager.saveMidpDirFiles(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getMidpDirFilesById(Long id) {
		MidpDirFilesEntity midpDirFiles = midpDirFilesManager.getMidpDirFilesById(id);
		return CommonUtils.msg(midpDirFiles);
	}

	@Override
	public R updateMidpDirFiles(MidpDirFilesEntity midpDirFiles) {
		int count = midpDirFilesManager.updateMidpDirFiles(midpDirFiles);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = midpDirFilesManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
